#ifndef __WORLD_SESSION_H__
#define __WORLD_SESSION_H__

#include "SocketServer.h"
#include "format.h"
#include <vector>
#include <mutex>
class Player;
class WorldSession
{
public:
	WorldSession(uint32 _socket);
	~WorldSession();

	uint32 GetAccountID()							{ return AccountId; }
	void SetSocketId(HSocket _socket)				{ m_socket = _socket; }
	HSocket GetSocket()								{ return m_socket; }
	void SetAccountID(uint32 _id)					{ AccountId = _id; }
	void SetPlayer(Player* _player);
	Player* GetPlayer()								{ return _Player; }
	void SetCanRecvMessage(bool _var)				{ CanSendNextPacket = _var; }
	bool CanRecvMessage()							{ return CanSendNextPacket; }
	void AddMessageToQueue(WorldPacket _packet);
private:
	
	std::mutex SessionMessageLock;
	void AutoSendMessageThread();
	uint32 AccountId;
	Player* _Player;
	bool CanSendNextPacket;
	std::vector<WorldPacket> sMessageQueue;
	HSocket m_socket;
};





#endif